package org.jeecg.modules.simulator.model.orbit;

import lombok.Getter;
import lombok.Setter;

import java.util.*;
import java.util.stream.Stream;

/**
 * @program: gp2
 * @description:
 * @author: renzhg
 * @create: 2024-09-04 13:53
 **/
public class OrbitPath extends LinkedList<OrbitPoint> {

    Map<String ,Integer > stationIndexMap=new HashMap<>();
    public OrbitPath(List<OrbitPoint> inputList) {
        super(inputList);
        // 使用默认的比较器对整数列表进行排序（升序）
        Collections.sort(this);

        inputList.forEach(orbitPoint -> {
            stationIndexMap.put(orbitPoint.getOrbitName(),orbitPoint.getIndex());
        });
    }

    public String getFirstPointName(){
        return this.getFirst().getOrbitName();
    }

    public Integer getPointIndex(String pointName){
        return  stationIndexMap.get(pointName);
    }

    public boolean isSameDirection(String sect){
        boolean isPositive = false;
        Stream<OrbitPoint> orbitPointStream = this.stream().filter(orbitPoint -> orbitPoint.getOrbitName().equals(sect));

        return isPositive;
    }
    @Getter
    @Setter
    boolean isUp;






    @Getter
    @Setter
    String trickId;
}
